<?php defined('IN_IA') or exit('Access Denied');?><?php (!empty($this) && $this instanceof WeModuleSite || 1) ? (include $this->template('base/common-header', TEMPLATE_INCLUDEPATH)) : (include template('base/common-header', TEMPLATE_INCLUDEPATH));?>

<div class="btn-group" role="group" aria-label="...">
    <a href="<?php  echo aurl('update')?>" class="btn btn-success">新增</a>
    <a href="javascript:;" class="btn btn-primary check-all-control">全选</a>
    <a href="<?php  echo aurl('remove')?>" class="btn btn-danger ajax-post confirm" data-form="#form" data-confirm="确定要删除勾选项吗?">删除</a>
</div>

<form action="<?php  echo aurl('index')?>" id="form_search" class="table-top-search form-inline" style="float: right" method="GET"
    data-search-ignore="page">
    <input type="text" name="act_name" class="form-control" value="<?php  echo $_GET['act_name'];?>" placeholder="搜索活动名称">
    <input type="text" name="act_mobile" class="form-control" value="<?php  echo $_GET['act_mobile'];?>" placeholder="搜索客服电话">
    <button class="btn btn-warning">搜索</button>
</form>



<form action="javascript:void(0)" method="POST" id="form">
    <table class="table table-hover">
        <thead>
            <tr>
                <th>#</th>
                <th>活动ID</th>
                <th>活动名称</th>
                <th>客服电话</th>
                <th>单/团/预&nbsp;价格</th>
                <th>浏览人数</th>
                <th>开始时间</th>
                <th>结束时间</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            <?php  if(is_array($list)) { foreach($list as $item) { ?>
            <tr>
                <td>
                    <input type="checkbox" name="act_id[]" class="check-all" value="<?php  echo $item['id'];?>">
                </td>
                <td>
                    <?php  echo $item['uni_id'];?>
                </td>
                <td>
                    <?php  echo $item['active_name'];?>
                </td>
                <td>
                    <?php  echo $item['service_mobile'];?>
                </td>
                <td>
                    <?php  echo $item['personal_price'];?>/<?php  echo $item['group_price'];?>/<?php  echo $item['pay_price'];?>&nbsp;元
                </td>
                <td>
                    <?php  echo $item['browse_num'];?>&nbsp;人
                </td>
                <td>
                    <?php  echo date("Y-m-d H:i:s",$item['start_time'])?>
                </td>
                <td>
                    <?php  echo date("Y-m-d H:i:s",$item['end_time'])?>
                </td>
                <td>
                    <a href="<?php  echo aurl('showUser', array('act_id'=>$item['id']))?>" class="label label-warning">订单</a>
                    <a href="<?php  echo aurl('update', array('act_id'=>$item['id']))?>" class="label label-success">修改</a>
                    <!-- 预览 -->
                    <a href="javascript:;" type="button" data-toggle="modal" data-target="#codepage<?php  echo $item['id'];?>" class="label label-info">预览</a>
                    <div class="modal fade" id="codepage<?php  echo $item['id'];?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                        <div class="modal-dialog" role="document">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                        <span aria-hidden="true">&times;</span>
                                    </button>
                                    <h4 class="modal-title" id="myModalLabel">活动二维码</h4>
                                </div>
                                <div class="modal-body">
                                    <div class="font" style="text-align:center">
                                        <!--  <img src="<?php  echo web2app_url('index',array('et' =>12,'codeid'=>$item['id']))?>"> -->
                                        <!-- <img src="<?php  echo aurl(10,['actid'=>$item['id']])?>"> -->
                                        <img src="<?php  echo aurl('linkMobule',['actid'=>$item['id']])?>" style="width: 300px;height: 300px;">
                                        <p class="help-block">扫描上方二维码，或<a href="javascript:;" class="cliplink" data-text="<?php  echo web2app_url('main', ['actid'=>$item['id']], '', $url)?>"> 点击复制此链接 </a>进入活动页面</p> 
                                    </div>
                                </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                                </div>
                            </div>
                        </div>
                    </div> 
                </td>
            </tr>
            <?php  } } ?>
        </tbody>
    </table>
    <?php  if(empty($list)) { ?> <p class="text-center">暂无数据</p> <?php  } ?>
    <?php  echo $page;?>
</form>
<script>
    require.config({
        appDir: '.',
        paths: {
            'clipboard': ['<?php echo WEB_RESOURCE;?>/lib/clipboard.min'] // 路径自定义，建议使用自己的文件而不是微擎自带的，微擎自带的clipboard不好使
        }
    });
    require(['clipboard'], function(Clipboard) {
        var clipboard = new Clipboard('.cliplink', {
            container: document.getElementById('myModalLabel'), // 如果以上html的内容在一个bootstrap的modal这类容器中，需要填写这句，填写当前容器的dom，否则删掉此句。
            text: function(e) {
                return $(e).data('text');
            }
        });
        clipboard.on('success', function(e) {
            xalert('复制成功', true, true);
        });
        clipboard.on('error', function() {
            xalert('复制失败', false, true);
        });
    });
    
</script>
<?php (!empty($this) && $this instanceof WeModuleSite || 1) ? (include $this->template('base/common-footer', TEMPLATE_INCLUDEPATH)) : (include template('base/common-footer', TEMPLATE_INCLUDEPATH));?>